package com.hengpeng.itfin.service.ehcache.impl;

import java.util.Observable;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hengpeng.itfin.service.ServiceFactory;
import com.hengpeng.itfin.service.ehcache.EhchaceObservableService;

/**
 * <pre>
 * 加载缓存
 * 
 * </pre>
 * @version 1.0, 2011-3-22
 */
@Transactional
@Service
@Lazy
public class EhchaceObservableServiceImpl extends Observable implements EhchaceObservableService
{
	public EhchaceObservableServiceImpl()
	{
		EhchaceObserver ehchaceObserver = new EhchaceObserver();
		this.addObserver(ehchaceObserver);
	}

	@Autowired
	private ServiceFactory servicefactory;

	// flush cache
	public void flushEhchaceWatcher(String ehchaceName)
	{
		servicefactory.getEhchaceService().flushEhchaceByName(ehchaceName);
		setChanged();
		notifyObservers(ehchaceName);
	}

}
